const getUrlParams = (name, url) => {
    if (url.indexOf('?') <= -1) {
        return;
    }
    let paramsStr = url.split("?")[1]; //userId=hsy251043&test=a
    let paramsList = paramsStr.split("&");// ['userId=hsy251043','test=a']
    let paramObj = {};
    paramsList.forEach(item => {
        var key = item.split("=")[0];
        var value = item.split("=")[1];
        paramObj[key] = value
    });

    if (paramObj[name]) {
        return paramObj[name]
    }
    return null; //返回参数值
}


module.exports = {
    getUrlParams
}